﻿using System.Net;
using System.Runtime.Serialization;

namespace Toybox.NicoSharp.Seiga
{
	using Extensions;
	using Utilities;

	partial class Book
	{

		#region [Static]

		public static UserStatus GetUserStatus(CookieCollection cookies = null)
		{
			cookies = cookies.Coerce();

			string url = NicoUrls.BookApi + "user/status";
			string json = NicoWebClient.Get(url, cookies);
			return Deserializer.JsonDeserializer<UserStatus>(json);
		}

		#endregion  [Static]

		[DataContract]
		public class UserStatus
		{
			[DataMember]
			public bool is_success;

			[DataMember]
			public User user;
		}

		[DataContract]
		public class User
		{
			[DataMember]
			public string id;

			[DataMember]
			public bool is_premium;

			[DataMember]
			public string username;

			[DataMember]
			public string is_twitter_authed;
		}

	}
}
